<% layout('/layouts/default.html', {title: '列检确认', libs: ['validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> 列检确认
			</div>
			<!-- <div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div> -->
		</div>
		<#form:form id="inputForm" model="${tblXdLjzyjl}" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="recId"/>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('检车人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="jcrCode" items="${jcrList}" itemLabel="jcrName" itemValue="jcrCode" class="form-control required" onchange="selChange()"/>
								<!-- <#form:select path="jcrCode" items="" itemLabel="mc" itemValue="bh"  style="margin-left: 38px !important;" class="form-control" blankOption="true"/> -->
								<#form:hidden path="jcrName"/>
							</div>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('口令')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="password" type="password" maxlength="50" class="form-control password"/>
							</div>
						</div>
					</div>
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('确认口令')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input id="password2" type="password" maxlength="50" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-6 col-sm-6">
						<a class="btn btn-primary btn-sm" id="btnSubmit" onclick="confirm()"><i class="glyphicon glyphicon-arrow-up"></i>  确 认   </a>
						<a class="btn btn-primary btn-sm" onclick="closePage()"><i class="fa fa-reply-all"></i> 取 消 </a>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
//确认
function confirm(){
	var recId = $("#recId").val();
	if(recId == ""){
		js.showMessage("结束失败!","","warning",4000);
		return;
	}
	
	var jcrCode = $("#jcrCode").val(); //检车人编码
	if(jcrCode == "" || jcrCode == null){
		js.showMessage("请输入检车人！","","error",4000);
		return;
	}
	var jcrName = $("#jcrName").val(); //检车人
	var password = $("#password").val(); // 口令
	if(password == "" || password == null){
		js.showMessage("请输入口令！","","error",4000);
		return;
	}
	var password2 = $("#password2").val(); // 确认口令
	if(password != password2){
		js.showMessage("输入口令与确认口令不一致，请确认！","","error",4000);
		return;
	}
	
	var msg = "确定进行【确认】操作？";  
	js.confirm(msg,function(data){
		var params = {"recId":recId,"jcrCode":jcrCode,"jcrName":jcrName,"password":password};
		$("#btnSubmit").attr("disabled", true);
	    $.post("${ctx}/tbl/tblXdDjzyjl/updateJCR",params,function(e){
	    	if(e.O_FLAG==0){
	    		js.showMessage('确认成功。', '', 'success', 4000);
	    		closePage();
	    	}else{
	    		js.showMessage(e.O_MESS, '', 'error', 4000);
	    		$("#btnSubmit").attr("disabled", false);
	    		return;
	    	}
	     },"json");
	});
}

function selChange(){
	var kclbName = $("#kclbCode").find("option:selected").text();
	$("#kclbName").val(kclbName);
	$("#faultCode").val($("#kclbCode").val());
}

//关闭按钮不关闭所有
function closePage(){
	parent.layer.closeAll(); 
}
</script>